const net = require("net");

const server = net.createServer(socket => {
    socket.once("data", data => {
        console.log(data + "hehe")
        socket.write(data);
    });
    socket.on("data", data => {
        console.log(data + "haha")
        socket.write("hahah" + data);
    });
}).listen(8888);